<?php
include_once dirname(__FILE__)."/../../ini.php";
include_once ROOTDIR.'/common/header.php';
include './../leftMenu.php';

?>
<script>
$(document).ready(function(){
	$("#login").click(function(){
	pseudo=$("#pseudo").val();
	password=$("#password").val();
	$.ajax({
		type: "POST",
		url: "auth.php",
		data: {pseudo:pseudo,password: password },
		success: function(data){
			if(data=="NOK"){
				alert("le mot de passe ou le pseudo est incorrect");
				}
			else {
				window.location.replace("<?php echo ROOTURL."/residences/residence/index.php?id=";?>"+data);
				}
		}
		
		});

		});
});

</script>
<form action="#">
<fieldset>
<legend title="connexion">Connexion</legend>
<table>
	<tr>
		<td><label for="pseudo">Pseudo</label></td>
		<td><input id="pseudo" type="text" name="pseudo" /></td>
	</tr>
	<tr>
		<td><label for="password">Password</label></td>
		<td><input id="password" type="password" name="password" /></td>
	</tr>
	<tr><td><img alt="" src="login.jpg" height="40" width="60" id="login"> </td></tr>
</table>
</fieldset>
</form>

<a href="<?php echo ROOTURL."/membres/signup.php";?>">Creer un compte</a>
<?php 
include_once ROOTDIR.'/common/footer.php';
?>